<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增faq问题答案')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-answer-add">
            <input type="hidden" th:value="${faqNo}" name="faqNo">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">问题答案：</label>
                <div class="col-sm-8">
                    <textarea name="answerAnswer"  id="answerAnswer" class="form-control" rows="7" placeholder="请输入答案..." required></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">答案分数：</label>
                <div class="col-sm-8">
                    <input name="answerFraction" class="form-control" type="number" max="10" min="1">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">是否采纳：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_faq_anser_adopt_status')}">
                        <input type="radio" th:id="${'faqType_' + dict.dictCode}" name="isAdopt" th:value="${dict.dictValue}" th:checked="${dict.default}">
                        <label th:for="${'faqType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">点赞数：</label>
                <div class="col-sm-8">
                    <input name="answerLikes" class="form-control" type="number" min="0">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">吐槽数：</label>
                <div class="col-sm-8">
                    <input name="answerRidicule" class="form-control" type="number" min="0">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/answer"
        $("#form-answer-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-answer-add').serialize());
            }
        }

        $("input[name='adoptTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>